<?php
class Admin_Model_Mail extends My_Model_Db
{
    protected $_name = 'mailing';
	protected $_primary  = 'p_mailing';
	protected $_mainTable = 'mailing';
	protected $_idFieldName = 'p_mailing';

	public function getListMail()
	{
		$sql = $this->getAdapter()->select()
		->from($this->_name)
		->order('dtcreat desc', 'hrcreat desc');

		return $this->getAdapter()->fetchAll($sql);
	}

	public function getMail($id)
	{
		$sql = $this->getAdapter()->select()
		->from($this->_name)
		->where('p_mailing = ?', $id);

		return $this->getAdapter()->fetchRow($sql);
	}

	public function removeMail($id)
	{
		$this->getAdapter()->delete($this->_name, "p_mailing =" . $id);
		return true;
	}
}